package com.itheima.service;

import com.itheima.bean.Student;
import com.itheima.mapper.StudentMapper;

import java.util.List;

// 业务层
public class StudentService {
    // 查询所有
    public List<Student> selectAll(){
        StudentMapper studentMapper = new StudentMapper();
        return studentMapper.selectAll();
    }

    // 添加
    public void insert(Student stu){
        StudentMapper studentMapper = new StudentMapper();
        studentMapper.insert(stu);
    }

    // 删除
    public void delete(Integer sid){
        StudentMapper studentMapper = new StudentMapper();
        studentMapper.delete(sid);
    }

    //
    public Student findByid(Integer sid){
        StudentMapper studentMapper = new StudentMapper();
        return studentMapper.findByid(sid);
    }

    // 修改
    public void update(Student stu){
        StudentMapper studentMapper = new StudentMapper();
        studentMapper.update(stu);
    }
}
